#include <stdio.h>
#include <math.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define EQUALS(a, b) (fabs((a) - (b)) < 0.000001)

int main(void) {
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        double ax, ay, ar, bx, by, br;
        scanf("%lf %lf %lf %lf %lf %lf", &ax, &ay, &ar, &bx, &by, &br);
        double d = sqrt(pow(ax - bx, 2) + pow(ay - by, 2));
        if (EQUALS(d + MIN(ar, br), MAX(ar, br))) {
            puts("2");
        } else if (MAX(ar, br) > d + MIN(ar, br)) {
            puts("1");
        } else if (EQUALS(MAX(ar, br) + MIN(ar, br), d)) {
            puts("4");
        } else if (MAX(ar, br) + MIN(ar, br) > d) {
            puts("3");
        } else {
            puts("5");
        }
    }
    return 0;
}
